<%@page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>

<script type="text/javascript">
	var form_url = base.contextPath+"/sysmgr/position/add.do" ;
	var position;
	$(function() {
		position = $("#position").combotree({
			url : base.contextPath+"/sysmgr/position/doNotNeedAuth_tree.do",
			idFiled:'pid', textFiled:'name', editable: false,
			lines:true, autoShowPanel: true
	    });
		
		if($('input[name=id]').val().length > 0) {
			form_url = base.contextPath+"/sysmgr/position/edit.do" ;
			$.post(base.contextPath+"/sysmgr/position/get.do", {id:$('input[name=id]').val()}, function(result) {
				if (result.id != undefined) {
					$('form').form('load', {
						'id' : result.id,
						'name' : result.name,
						'remark' : result.remark,
						'pid' : result.pid
					});
				}
			}, 'json');
		}
	});
	
	//提交表单数据
	var submitNow = function($d, $t) {
		$.post(form_url, $("#form").form("getData"), function(result) {
			if (result.status) {
				$t.treegrid('reload') ;
				alertify.success(result.msg);$.easyui.loaded(); $d.dialog("close") ;
			} else {
				$.easyui.loaded();$.messager.alert("错误", result.msg, "error");
			}
		}, 'json');
	};
	
	//验证表单
	var submitForm = function($d, $t) {
		if($('#form').form('validate')) {
			$.easyui.loading({ msg: "数据提交中，请稍等..." });
			submitNow($d, $t) ;
		}
	};
	
	
</script>
<form id="form" class="easyui-form form_container">
	<input type="hidden" name="id" value="${id}" />
	<input type="hidden" name="modifyName" value="${USER_SESSION.truename}" />
	<table class="tableform">
		<tr>
			<th>职位/岗位名称：</th>
			<td><input name="name" class="easyui-validatebox" type="text" data-options="required: true,prompt: '职位、岗位名称'" /></td>
		</tr>
		<tr>
			<th>上级职位：</th>
			<td><input id="position" name="pid" style="width:220px;height:30px;" data-options="prompt: '上级职位'" /><a onClick="position.combotree('setValue','');" class="easyui-linkbutton" data-options="plain: true, iconCls: 'ext_clear'"></a></td>
		</tr>
		<tr>
			<th>简介：</th>
			<td>
				<textarea id="u1" name="remark" style="width:310px;height:120px;"></textarea>
			</td>
		</tr>
	</table>
</form>

